package com.ljkj.blockpay.presenter;

import android.content.Context;

import androidx.annotation.NonNull;

import com.kongzue.baseokhttp.HttpRequest;
import com.kongzue.baseokhttp.listener.JsonResponseListener;
import com.kongzue.baseokhttp.util.JsonMap;
import com.kongzue.baseokhttp.util.Parameter;
import com.ljkj.blockpay.basedata.BasePresenterImpl;
import com.ljkj.blockpay.basedata.BaseView;
import com.ljkj.blockpay.network.ApiToCConfig;
import com.ljkj.blockpay.presenter.inter.TradingInter;

/**
 * Created by yp on 2022/2/25
 */
public class TradingParticularsPresenter extends BasePresenterImpl<TradingInter.TradingInterView> implements  TradingInter.TradingInterPresenter{

    public TradingParticularsPresenter(@NonNull Context context, @NonNull TradingInter.TradingInterView view) {
        super(context, view);
    }

    @Override
    public void orderDetail(String orderId) {
        HttpRequest.GET(getContext(), ApiToCConfig.URL_DETAIL, new Parameter().add("orderId", orderId), new JsonResponseListener() {
            @Override
            public void onResponse(JsonMap main, Exception error) {
                if (main.getInt("code") == 0){
                    JsonMap jsonMap = main.getJsonMap("data");
                    getView().orderDetailSuccess(jsonMap);

                }
            }
        });

    }
}
